<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    const person = {
      name: 'a',
      age: 1
    }
    console.log(Object.keys(person));
    console.log(Object.values(person));
    console.log(Object.entries(person));
    //与数组类似方法的区别
    console.log([1, 2].keys());
    console.log([1, 3].values());
    console.log([3, 5].entries());
    //数组的keys() values() entries() 等方法是实例方法，返回的都是Iterator
    //对象的是构造函数方法，返回的数组
    //使用for of遍历对象
    for(let key of Object.keys(person)){
      console.log(key);
    }
    for(let value of Object.values(person)){
      console.log(value);
    }
    for(let entrie of Object.entries(person)){
      console.log(entrie);
    }
  </script>
</body>

</html>